package com.github.bridge.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
public class OuterUserSignatureDTO extends BaseDTO {

    @Schema(description = "个人账号ID（创建个人签署账号接口返回）", requiredMode = Schema.RequiredMode.REQUIRED)
    private String accountId;

//    @Schema(description = "个人认证流程ID（通过 【个人核身认证服务】 任意一种方式完成认证后的flowId）", requiredMode = Schema.RequiredMode.REQUIRED)
//    private String willingnessId;

    @Schema(description = "印章Base64数据", requiredMode = Schema.RequiredMode.REQUIRED)
    private String sealData;

    @Schema(description = "签章类型，<br/>" +
            "Single-单页签章 <br/>" +
            "Multi-多页签章 <br/>" +
            "Edges-签骑缝章 <br/>" +
            "Key-关键字签章 <br/>" +
            "【补充说明】：" +
            "关键字签章是全文检索合同中存在的文字，例如：keyWord=“甲方盖章”。就会在合同中检索存在“甲方盖章”这几个字的地方盖章", allowableValues = {"Single", "Multi", "Edges", "Key"}, requiredMode = Schema.RequiredMode.REQUIRED)
    private String signType;

    @Schema(description = "签署PDF文件信息", requiredMode = Schema.RequiredMode.REQUIRED)
    private FileParam fileBean;

    @Schema(description = "签章位置信息", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<PosBean> posBeans;

    @Schema(description = "印章规格，默认：IMAGE <br/>" +
            "IMAGE-图片base64 <br/>" +
            "GB_SEAL-国标印章", defaultValue = "IMAGE", allowableValues = {"IMAGE", "GB_SEAL"}, requiredMode = Schema.RequiredMode.REQUIRED)
    private String sealSpec;

    @Data
    public static class FileParam {
        @Schema(description = "文件名称 该文件名称会显示在套餐消费账单里，<br/> " +
                "后续对接方可以根据该名称和签署记录ID对账使用", requiredMode = Schema.RequiredMode.REQUIRED)
        private String fileName;

        @NotBlank(message = "fileKey不能为空")
        @Schema(description = "待签署文件fileKey", requiredMode = Schema.RequiredMode.REQUIRED)
        private String fileKey;
//        @Schema(description = "待签署PDF文件本地路径，含文件名（与streamFile至少有一个不为空）")
//        private String srcPdfFile;
//        @Schema(description = "待签署PDF文件本地二进制数据（与srcPdfFile至少有一个不为空，两者都传优先取streamFile）")
//        private byte[] streamFile;
//        @Schema(description = "签署后PDF文件本地路径，含文件名（为空时返回签署后的文件流）")
//        private String dstPdfFile;
//        @Schema(description = "文件名称，若为空则取文件路径中的名称")
//        private String fileName;
        @Schema(description = "文件编辑密码，当目标PDF设置权限保护时必填")
        private String password;
    }

    @Data
    public static class PosBean {
        @Schema(description = "签署页码（除关键字签章外，页码均不可为空）签署页码（除关键字签章外，页码均不可为空）</br>" +
                "若为多页签章，支持指定多个页码，例如格式：“1-3,5,8“")
        private String posPage;
        @Schema(description = "签署位置X坐标，默认0")
        private Float posX;
        @Schema(description = "签署位置Y坐标，默认0")
        private Float posY;
        @Schema(description = "关键字")
        private String keyWord;
        @Schema(description = "印章展现宽度，将以此宽度对印章图片做同比缩放。")
        private Float width;
        @Schema(description = "是否显示本地签署时间，需要width设置92以上才可以看到时间，时间格式：yyyy-MM-dd HH:mm:ss")
        private Boolean addSignTime;
    }

}
